<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>
Options JVM screen
</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>Options JVM screen</H1>
<p>
This screen allows you to configure the JVM options used when starting ZAP.
</p>

<H3>JVM Options</H3>
A free format text field which will be added to the Java command line call
when invoking ZAP via either zap.sh or zap.bat.
</p>
<p>
The option was added so that the Java maximum memory allocation pool size can be set, 
which is of the form: -Xmx<i>n</i> where <i>n</i> is the size in bytes.<br>
Good values for this field could be:
<ul>
<li>-Xmx256m</li>
<li>-Xmx512m</li>
<li>-Xmx1024m</li>
</ul>
<p>
Unlike the other ZAP options these are held in the file <code>.ZAP_JVM.properties</code> in the user's default ZAP directory,
which depends on the OS being used, for example:
<ul>
<li>Windows 7/8: C:\Users\<i>&lt;username&gt;</i>\OWASP ZAP</li>
<li>Windows XP: C:\Documents and Settings\<i>&lt;username&gt;</i>\OWASP ZAP</li>
<li>Linux: ~/.ZAP</li>
<li>Mac OS: ~/Library/Application Support/ZAP</li>
</ul>
If you make a mistake when setting these options then ZAP may fail to start.<br>
If that happens then deleting this file should fix the problem.
<p>
<strong>Windows Notes:</strong> These options are not used when starting ZAP via the executable. The directory where the file <code>.ZAP_JVM.properties</code> is located depends on the environment variable <code>%USERPROFILE%</code>.

<H3>JVM Memory Details</H3>
The lower portion of the dialog displays details of the current JVM memory configuration. Including: 
  <ul>
    <li>Size - the amount of memory currently allocated to the JVM.</li> 
    <li>Used - the amount of currently allocated memory used (not free).</li>
    <li>Max - the amount of memory that the JVM could grow to occupy.</li>
  </ul>
The values are displayed in human readable IEC units based on base 2 calculation (for example: 1024Bytes equals 1KiB, etc).
<p>
Generally max should be close to -Xmx (if specified). However, the following behavior was observed during testing under Java 8 on Windows OS.
<p>
-Xmx512m was specified (which should calculate out to ~488MiB), however, 455.5MiB was displayed.<br>
-Xms512m -Xmx512m was specified, however, 475MiB was displayed.<br>
-XX:+AlwaysPreTouch -Xms512m -Xmx512m, and 474.5MiB was displayed.
<p>
So it seems the JVM does some calculation/manipulation at execution which may mean that the results may not align as expected for the 
options the user inputs (this is a JVM issue, not a ZAP issue).

<H2>See also</H2>
<table>
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a href="../../overview.html">UI Overview</a></td><td>for an overview of the user interface</td></tr>
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a href="options.html">Options dialogs</a></td><td>for details of the other Options dialog screens</td></tr>
</table>

<H2>External links</H2>
<table>
<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td><a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/java.html#BABDJJFI">Java 8 options</a></td></tr>
</table>

</BODY>
</HTML>
